"use strict";

/**
 * @name setRelatedData 
 * 设置buildings中相关数据
 */


/**
 * @name setBuildingSkin
 * @param string buildID 建筑ID
 * @param int skinID 建筑皮肤ID
 * 设置建筑皮肤
 */
exports.setBuildingSkin = async function () {
    let buildID = this.get('buildID', 'string');
    let skinID = this.get('skinID', 'int');
    if (!buildID || !skinID) {
        return this.quick_error("参数错误");
    }
    let skinConfig = this.config('buildSkin', skinID);
    if (!skinConfig) {
        return this.quick_error("M2saghge40", "建筑皮肤数据不存在", skinID);
    }
    this.updater.item.key(skinID);
    await this.updater.data();
    let skinData = this.updater.item.get(skinID);
    if (!skinData) {
        return this.quick_error("M2saghge20", "没有拥有该皮肤", skinID);
    }

    this.updater.item.set(buildID, "skin", skinID);
    return this.updater.save();

}

/**
 * @name set 
 */

